<%-- 
    Document   : uploadCSV
    Created on : Oct 1, 2013, 1:53:34 AM
    Author     : Thai Ha Cong
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="description" content="Bidding Strategy - Knapsack Problem">
        <title>Bidding Strategy - Knapsack Problem</title>
        <link href="<%= request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/adMenu.css" rel="stylesheet" type="text/css"/>
        <s:head />
    </head>
    <body>
        <div class="headerbg">
            <%@include file="/include/mHeader.jsp" %>
        </div>
        <div class="contentbg">
            <div class="content">
                <div class="adMenu">
                    <%@include file="/include/mMenu.jsp" %>
                </div>
                <div class="kpbg">
                    <div class="onlineKP">
                        <h2>Online Knapsack Problem Threshold</h2>
                        <h3>Please choose a .csv with history data as an input file</h3>

                        <s:form action="kpResult" namespace="/Administration/Bidding" method="post" enctype="multipart/form-data">
                            <s:file name="inputFile" label="Input File" cssStyle=""/>
                            <s:textfield name="keyword" label="Keyword" size="32" cssStyle=""/>
                            <!--s:property value="getText('{0,number,#,##0.00}',{revenue})"/-->
                            <s:textfield name="revenue" label="Revenue of each Item" size="32" cssStyle="" value="%{getText('{0,number,#,##0.00}',{revenue})}"/>
                            <s:textfield name="conversionRate" label="Estimated Conversion Rate" size="32"/>
                            <s:textfield name="budget" label="Total Budget" size="32" cssStyle=""/>
                            <s:textfield name="spentBudget" label="Spent Budget" size="32" cssStyle=""/>
                            <s:textfield name="bmin" label="Minimum Bid Price" size="32" cssStyle=""/>
                            <table>
                                <tr>
                                    <td><s:submit value="Solve" cssStyle="width: 77px; margin-left: 156px;" theme="simple"/></td>
                                </tr>
                            </table>
                        </s:form>

                        <p style="font-size: 20px;">
                            <b>Recommended bid price: </b>
                            <!--for Keyword "<b><s:property value="keyword"/></b>":--> 
                            <span style="color: red; font-weight: bold">
                                <s:property value="onlinekpOutput"/>
                            </span>
                        </p>
                    </div>
                    <div class="mckp">
                        <h2>Revenue Maximization</h2>

                        <br><br>
                        <p>This algorithm does not need any file or keyword as input.</p>
                        <br>
                        <p>Revenue of each Item: <b><s:text name="format.money"><s:param value="revenue"/></s:text></b></p>
                        <p>Revenue per Click: <b><s:text name="format.money"><s:param value="revenuePerClick"/></s:text></b></p>
                        <p>Total Budget: <b><s:text name="format.money"><s:param value="budget"/></s:text></b></p>
                        <p>Spent Budget: <b><s:text name="format.money"><s:param value="spentBudget"/></s:text></b></p>
                        <p>Minimum Bid Price: <b><s:text name="format.money"><s:param value="bmin"/></s:text></b></p>

                            <p style="font-size: 20px;">
                                <br><br>
                                <b>Recommended bid price: </b>
                                <span style="color: red; font-weight: bold">
                                <s:text name="format.money">
                                    <s:param value="revMaxOutput"/>
                                </s:text>
                            </span>
                        </p>
                        <!--In this algorithm, keyword does not matter.-->
                    </div>
                    <div class="displayData">
                        <h3>Sample Data</h3>

                        <table class="sampleData">
                            <tr>
                                <th class="bDate">Date</th>
                                <th class="bKey">Keyword</th>
                                <th class="bQS">Quality Score</th>
                                <th class="bCPC">Max. CPC</th>
                                <th class="bImp">Impressions</th>
                                <th class="bClk">Clicks</th>
                                <th class="bCTR">CTR (%)</th>
                                <th class="bAcpc">Avg. CPC</th>
                                <th class="bCost">Cost ($)</th>
                                <th class="bApos">Avg. Position</th>
                            </tr>

                            <s:iterator value="bidItems" status="i">
                                <s:if test="#i.index < 10">
                                    <s:if test="#i.index % 2 == 1">
                                        <tr class="evenRow">
                                            <td class="bDate">
                                                <s:date name="date" format="mm/dd/yy"/>
                                            </td>
                                            <td class="bKey">
                                                <s:property value="keyword"/>
                                            </td>
                                            <td class="bQS">
                                                <s:property value="qualityScore"/>
                                            </td>
                                            <td class="bCPC">
                                                <s:text name="format.money">
                                                    <s:param value="cpc"/>
                                                </s:text>
                                            </td>
                                            <td class="bImp">
                                                <s:property value="impressions"/>
                                            </td>
                                            <td class="bClk">
                                                <s:property value="clicks"/>
                                            </td>
                                            <td class="bCTR">
                                                <s:text name="format.percent">
                                                    <s:param value="ctr"/>
                                                </s:text>
                                            </td>
                                            <td class="bAcpc">
                                                <s:text name="format.money">
                                                    <s:param value="avgCpc"/>
                                                </s:text>
                                            </td>
                                            <td class="bCost">
                                                <s:text name="format.money">
                                                    <s:param value="cost"/>
                                                </s:text>
                                            </td>
                                            <td class="bApos">
                                                <s:property value="avgPosition"/>
                                            </td>
                                        </tr>
                                    </s:if>
                                    <s:else>
                                        <tr class="oddRow">
                                            <td class="bDate">
                                                <s:date name="date" format="mm/dd/yy"/>
                                            </td>
                                            <td class="bKey">
                                                <s:property value="keyword"/>
                                            </td>
                                            <td class="bQS">
                                                <s:property value="qualityScore"/>
                                            </td>
                                            <td class="bCPC">
                                                <s:text name="format.money">
                                                    <s:param value="cpc"/>
                                                </s:text>
                                            </td>
                                            <td class="bImp">
                                                <s:property value="impressions"/>
                                            </td>
                                            <td class="bClk">
                                                <s:property value="clicks"/>
                                            </td>
                                            <td class="bCTR">
                                                <s:text name="format.percent">
                                                    <s:param value="ctr"/>
                                                </s:text>
                                            </td>
                                            <td class="bAcpc">
                                                <s:text name="format.money">
                                                    <s:param value="avgCpc"/>
                                                </s:text>
                                            </td>
                                            <td class="bCost">
                                                <s:text name="format.money">
                                                    <s:param value="cost"/>
                                                </s:text>
                                            </td>
                                            <td class="bApos">
                                                <s:property value="avgPosition"/>
                                            </td>
                                        </s:else>
                                </s:if>
                            </s:iterator>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="footerbg">
            <%@include file="/include/iFooter.jsp" %>
        </div>
    </body>
</html>

